package org.example.pack1210;

import org.example.pack1210.bean.Emp;
import org.example.pack1210.dao.EmpDAO;

import java.util.List;

import java.util.List;

public class App {
    private static EmpDAO edao = new EmpDAO();

    private static void a() {
        Emp emp = new Emp();
        emp.setEnname("李永康");
        emp.setJob("相声大师");
        emp.setSal(9800.0);
        emp.setComm(300.0);
        emp.setMgr(7935);
        emp.setDeptNo(40);
        edao.save(emp);
    }

    private static void b() {
        edao.delete(7963);
    }

    private static void c() {
        Emp emp = new Emp();
        emp.setEmpNo(7990);
        emp.setDeptNo(40);
        emp.setJob("健身教练");
        emp.setSal(7777.0);
        emp.setComm(100.0);
        emp.setEnname("杨路强");
        emp.setMgr(7956);
        edao.update(emp);
    }

    private static void d() {
        Emp emp = edao.findById(7983);
        System.out.println(emp);
    }

    private static void e() {
        List<Emp> all = edao.findAll();
        all.forEach(System.out::println);
    }

    private static void f() {
        List<Emp> all = edao.findByEname("路");
        all.forEach(System.out::println);
    }

    private static void g() {
        List<Emp> all = edao.findByPage(3);
        all.forEach(System.out::println);
    }


    public static void main(String[] args) {
        e();
    }
}